<?php
session_start();
ob_start('ob_gzhandler');
include_once('config.php');

if(@$_GET['danhmuc']){
	$dm = $_GET['danhmuc'];
	$dm = explode('/',$dm);
	$danhmuc = $dm[0];
	if($dm[1]=='') $page = 1; else $page = $dm[1];
	$menu_one = $tc->menu_one($danhmuc);
	$row_menu_one = mysql_fetch_array($menu_one);
	$idMenu = $row_menu_one['id'];
	$type = $row_menu_one['type_id'];
	if(!@$_GET['detail']){
		($row_menu_one['url_hinh']=='') ? $image='http://'.$domain.'/'.url_default_image : $image='http://'.$domain.'/'.url_danhmuc_image.$row_menu_one['url_hinh'];
		$url = 'http://'.$domain.'/'.$row_menu_one['url'];
		$seo = $tc->seo($domain,$row_menu_one['title'],$row_menu_one['metaDescription'],$row_menu_one['metaKeyword'],$image,$url);
		switch($type){
			case 2 : include_once('blocks/list_articles.php'); break;
			case 7 : include_once('blocks/contact.php'); break;
			default: $view_post = '<font color="#FFF"><b>Could not be found</b></font>';
		}
	}else{
		$dt = $_GET['detail'];
		$detail = $tc->detail($dt);
		$row_detail = mysql_fetch_array($detail);
		($row_detail['url_hinh']!='') ? $image='http://'.$domain.'/'.url_detail_thumb_image.$row_detail['url_hinh'] : $image='http://'.$domain.'/'.url_default_image;
		$url = 'http://'.$domain.'/'.$row_menu_one['url'].$row_detail['name_rewrite'].'.html';
		$seo = $tc->seo($domain,$row_detail['name'],$row_detail['description'],$row_detail['metaKeyword'],$image,$url);
		include_once('blocks/articles.php');
	}
}else{
	$menu_one = $tc->menu_one('trang-chu');
	$row_menu_one = mysql_fetch_array($menu_one);
	$url = 'http://'.$domain;
	($row_menu_one['url_hinh']=='') ? $image='http://'.$domain.'/'.url_default_image : $image='http://'.$domain.'/'.url_danhmuc_image.$row_menu_one['url_hinh'];
	$seo = $tc->seo($domain,$row_menu_one['title'],$row_menu_one['metaDescription'],$row_menu_one['metaKeyword'],$image,$url);
	include_once('blocks/home.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php echo $seo; ?>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="library/jquery.js"></script>
<link href="assets/wt-rotator.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="assets/jquery.wt-rotator.min.js"></script>
<script type="text/javascript" src="assets/preview.js"></script>
</head>
<body>
<div id="bgmenu"></div>
<div id="wrapper">
	<?php
    require 'blocks/header.php';
	require 'blocks/menu.php';
    require 'blocks/slider.php';
	echo '<div style="clear:both; height:10px;"></div><div id="left">'.$view_post.'</div>';
	require 'blocks/right.php';
	?>
</div>
<div style="clear:both"></div>
<div id="footer">
	<div class="content">
    	<div id="menufoo">
			<?php echo $row_config['footer'];?>
            <div style="clear:both; padding:25px 0 15px 0"><?php echo $row_config['contact'];?></div>
        </div>
        <div id="hotline"><!--Hotline: <span>0903 646 893</span>--></div>
        <div id="toppage"><a href="<?php echo $_SERVER['REQUEST_URI'];?>#" title="top" target="_top"><img src="images/top.png" alt="top page cooking class" /></a></div>
        <div style="clear:both"></div>
    </div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		$('.item:even').css('margin-right', '12px');
		$('#txtSearch').click(function(){
			$('#txtSearch').css('background','url(images/txtSearch2.png)');
		});
		$('input[name=btnSearch]').click(function(){
			var txtSearch = $('input[name=txtSearch]').val();
			$('form[name=frmSearch]').attr('action', 'search/' + txtSearch + '/');
		});
	});
</script>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-39036195-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</body>
</html>